package com.swh.xbsc.mapper;

import com.alibaba.excel.util.StringUtils;
import org.apache.ibatis.jdbc.SQL;

import java.util.Map;

/**
 * @Author: swh
 * @Description:
 * @Date: 2020/11/18 11:33
 * @Version: 1.0
 */
public class UserProvider {
    public String selectPage(Map<String, Object> map){
        return new SQL(){{
            SELECT("id, " +
                    "username, " +
                    "`password`, " +
                    "email, " +
                    "qq_openid, " +
                    "wx_openid, " +
                    "real_name, " +
                    "age, " +
                    "phone, " +
                    "gender, " +
                    "info, " +
                    "register_time, " +
                    "login_time, " +
                    "pic, " +
                    "look, " +
                    "is_secret, " +
                    "dept_name, " +
                    "dept_id");
            FROM("`user` ");
            if (map.containsKey("username") && !StringUtils.isEmpty(map.get("username"))) {
                WHERE(" username like CONCAT('%',#{username},'%')");
            }
        }}.toString();
    }

}
